home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / mawk10.zip / MAWK_TES.V7 < prev    next >
Text File  |  1991-10-05  |  2KB  |  101 lines

  1. : 'This is a simple test that a new made mawk seems to'
  2. : 'be working OK.'
  3. : 'It is certainly not exhaustive, but the last two tests in'
  4. : 'particular use most features.'
  5. :
  6. : 'It needs to be run from  mawk/test'
  7. : 'and mawk needs to be in PATH'
  8. :
  9.  
  10. dat=mawk_test.dat
  11.  
  12. trap 'echo mawk_test failed ; rm -f temp$$ ; exit 1'  0
  13.  
  14. : 'find out which mawk we are testing'
  15. ./mawk -V
  16.  
  17.  
  18. echo testing input and field splitting
  19. ./mawk -f wc.awk $dat > temp$$
  20.  
  21. ( cat | cmp -s  - temp$$ ) <<@@
  22. 107 479
  23. @@
  24.  
  25. [ $? = 0 ] || exit
  26.  
  27. echo input and field splitting OK
  28.  
  29. echo
  30. echo testing regular expression matching
  31. ./mawk -f reg0.awk $dat > temp$$
  32. ./mawk -f reg1.awk $dat >> temp$$
  33. ./mawk -f reg2.awk $dat >> temp$$
  34.  
  35. ( cat | cmp -s  - temp$$ ) <<@@
  36. 3
  37. 4
  38. 1
  39. @@
  40.  
  41. [ $? = 0 ] || exit
  42. echo regular expression matching OK
  43.  
  44. echo
  45. echo testing arrays and flow of control
  46. ./mawk -f wfrq0.awk $dat > temp$$
  47.  
  48. ( cat | cmp -s  - temp$$ ) <<@@
  49.  29 p
  50.  21 A
  51.  14 ANODE
  52.  13 q
  53.  12 d
  54.  12 sval
  55.  10 if
  56.  10 the
  57.   8 dlink
  58.   8 is
  59.   8 h
  60.   7 to
  61.   6 of
  62.   6 D
  63.   5 hash
  64.   5 deleted
  65.   5 else
  66.   5 link
  67.   5 front
  68.   5 cflag
  69. @@
  70.  
  71. [ $? = 0 ] || exit
  72. echo array test OK
  73.  
  74. echo
  75. echo testing function calls and general stress test
  76. ./mawk -f ../examples/decl.awk $dat > temp$$
  77.  
  78. ( cat | cmp -s - temp$$ ) <<'@@'
  79. hash: function returning unsigned (extern)
  80. last_dhash: unsigned (static)
  81. A: ARRAY
  82. sval: pointer to STRING
  83. cflag: int
  84. A: ARRAY
  85. d: double
  86. cflag: int
  87. ap: pointer to ANODE
  88. signal: function returning pointer to function returning void
  89. @@
  90.  
  91. [ $? = 0 ] || exit
  92. echo general stress test passed
  93.  
  94.  
  95. echo
  96. echo  tested mawk seems OK
  97.  
  98. trap 0
  99. rm -f temp$$
  100. exit 0
  101.